package com.tjvib.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class FormatUtil {

    public static boolean isValidPhoneNumber(String phoneNumber) {
        String regex = "^(1[3-9]\\d{9}$)";
        if (phoneNumber.length() == 11) {
            Pattern p = Pattern.compile(regex);
            Matcher m = p.matcher(phoneNumber);
            return m.matches();
        }
        return false;
    }

    public static boolean isValidSmsCode(String SmsCode) {
        String regex = "^(\\d{6}$)";
        if (SmsCode.length() == 6) {
            Pattern p = Pattern.compile(regex);
            Matcher m = p.matcher(SmsCode);
            return m.matches();
        }
        return false;
    }
}
